package erlwitch.tree;

import java.util.ArrayList;
import java.util.List;

public class FunctionDef {
	private String name;
	private int arity;
	private List<FunctionClause> clauses;
	public List<FunctionClause> getClauses() {
		return clauses;
	}
	public void setClauses(List<FunctionClause> clauses) {
		this.clauses = clauses;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getArity() {
		return arity;
	}
	public void setArity(int arity) {
		this.arity = arity;
	}
	public FunctionDef(String name, int arity, List<FunctionClause> clauses) {
		super();
		this.name = name;
		this.arity = arity;
		this.clauses = clauses;
	}
	public FunctionDef(FunctionClause lastClause) {
		name = lastClause.getName();
		arity = lastClause.getParams().size();
		clauses = new ArrayList<FunctionClause>();
		clauses.add(lastClause);
	}
	public void addClause(FunctionClause clause) {
		clauses.add(0, clause);
	}
}
